import java.util.Scanner;
/**
 * Created with Intellij IDEA
 * Description
 * User:ASUS
 * Date:2024-05-18
 * Time:10:22
 */
//Soundable接口
interface Soundable{
    void Sound();
    void Volume(int level);
}
//Radio类实现Soundable接口
class Radio implements  Soundable{
    public void Sound(){
        System.out.println("收音机发出来电铃声：叮当、叮当");
    }

    public void Volume(int level) {
        System.out.println("您是否要降低音量？"+level);
    }
}
//Walkman类实现Soundable接口
class Walkman implements  Soundable{
    public void Sound(){
        System.out.println("随身听发出来电铃声：叮当、叮当");
    }

    public void Volume(int level) {
        System.out.println("您是否要降低音量？"+level);
    }
}
//MobilePhone类实现Soundable接口
class MobilePhone implements  Soundable{
    public void Sound(){
        System.out.println("手机发出来电铃声：叮当、叮当");
    }
    public void Volume(int level) {
        System.out.println("您是否要降低音量？"+level);
    }
}
public class Application {
    public static void main(String[] args) {
        Soundable soundDevice;
        Scanner scanner = new Scanner(System.in);

        System.out.println("你想听什么？请输入: ");
        System.out.println("0-收音机  1-随身听  2-手机");
        int choice = scanner.nextInt();

        switch (choice) {
            case 1:
                soundDevice = new Radio();
                break;
            case 2:
                soundDevice = new MobilePhone();
                break;
            case 3:
                soundDevice = new Walkman();
                break;
            default:
                System.out.println("没有这个选择");
                return;
        }
        soundDevice.Sound();
        System.out.println("您是否要降低音量？");
        System.out.println("1-是  2-否");
        int level= scanner.nextInt();
        switch (level){
            case 1:
                System.out.println("已降低手机音量");
                break;
            case 2:
                System.out.println("已提高手机音量");
                break;
            default:
                System.out.println("没有这个选择");
                return;
        }
        System.out.println("您是否要关机？");
        System.out.println("1-是  2-否");
        int close= scanner.nextInt();
        switch (close){
            case 1:
                System.out.println("已关闭手机");
                break;
            case 2:
                System.out.println("已取消");
                break;
            default:
                System.out.println("没有这个选择");
                return;
        }

    }
}
